<template>
	<page-body>
		<view class="page">
			<!---flex布局flex布局开始-->
			<view class="flex flex-wrap align-start benben-flex-layout theory_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between theory_fd0_0'>
					<view class="btns">
						<text class='fu-iconfont2  theory_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
							data-url="1">&#xe794;</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<text class='theory_fd0_0_c1_c0'>军事理论</text>
					</view>
					<view class="btns">
						<!--  <text class='fu-iconfont2  theory_fd0_0_c2' @tap.stop="handleJumpDiy" data-type="navigateTo"
            :data-url="`/pageguofang/honoDeta/search/search?are=2`">&#xe722;</text> -->
					</view>

				</view>
			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局结束-->
			<!---金刚区轮播flex布局开始-->
			<view class="flex benben-flex-layout flex-wrap align-center theory_flex_1">
				<view style="position: relative">
					<swiper ref="benbenSwiperfd1_0" @change="bannerIndexfd1_0 = $event.detail.current"
						class='flex position-relative theory_fd1_0' previous-margin="0rpx" next-margin="0rpx"
						:display-multiple-items="1" :interval="5000" :duration="500" :circular='true'>
						<template>
							<swiper-item class='flex  theory_fd1_0_c1' v-for='(item,key0) in groupedArray' :key='key0'>
								<template v-for='(child,key1) in item'>
									<view class='flex flex-direction flex-wrap align-center theory_fd1_0_c1_c0'
										@tap.stop="articleunFunc(child.aid)" :key='child.aid'>
										<image class='theory_fd1_0_c1_c0_c0' mode="aspectFit" :src='child.img_url'>
										</image>
										<text class='theory_fd1_0_c1_c0_c1'>{{child.affair}}</text>
									</view>
								</template>
							</swiper-item>
						</template>
					</swiper>
					<view style="position: absolute"
						class="flex dot flex align-center justify-center theory_swiperDotfd1_0">
						<template v-for="(item, index) in (groupedArray.length)">
							<view :key="index" v-if="bannerIndexfd1_0 == index"
								class="flex dot selected flex align-center justify-center theory_swiperDotSelectedfd1_0">
							</view>
							<view :key="index" v-else
								class="flex dot unselected flex align-center justify-center theory_swiperDotUnselectedfd1_0">
							</view>
						</template>
					</view>
				</view>
			</view>

			<!---金刚区轮播flex布局结束-->
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout theory_flex_2">
				<template v-for='(item,key0) in article'>
					<view class='flex flex-wrap align-center theory_fd2_0' @tap.stop="navs(item.aid)" :key='key0'>
						<view
							class='flex flex-direction flex-wrap align-stretch self-start justify-between theory_fd2_0_c0'>
							<text class='theory_fd2_0_c0_c0'>{{item.title}}</text>
							<view class='flex flex-wrap align-center theory_fd2_0_c0_c1'>
								<text class='theory_fd2_0_c0_c1_c0'>{{item.create_time}}</text>
							</view>
						</view>
						<image class='theory_fd2_0_c1' mode="aspectFill" :src='item.thumb'></image>
					</view>
				</template>
				<fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
					:listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
			</view>
			<!---flex布局flex布局结束-->
		</view>
	</page-body>
</template>
<script>
	import pagingList from '@/common/mixin/paging_list.js';
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},
		mixins: [pagingList],

		data() {
			return {
				"bannerIndexfd1_0": 0,
				"minixPagingListsApi": "",
				"pageingListApiMethod": "",
				"allowOnloadGetList": false,
				"article": [],
				"tabs": [],
				"tabnum": ""
			};
		},
		computed: {
			groupedArray() {
				let grouped = [];
				let remainder = [];
				for (let i = 0; i < this.tabs.length; i += 4) {
					let group = this.tabs.slice(i, i + 4);
					if (group.length < 4) {
						remainder = group;
					} else {
						grouped.push(group);
					}
				}
				if (remainder.length > 0) {
					grouped.push(remainder);
				}
				return grouped;
			}
		},
		watch: {},
		onLoad(options) {

			this.getul6beef671a111Func()
			this.articleunFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			uni.setStorageSync("are", 2)
		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			/* 跳转详情*/
			navs(aid) {
				console.log(aid)
				uni.navigateTo({
					url: "/pageguofang/guofang/trendPari/trendPari?aid=" + aid
				})
			},
			//文章列表
			articleunFunc(id = 1) {
				this.minixPagingListsApi = global.apiUrls.post66beefcc0ebfb;
				this.pageingListApiMethod = 'get';
				this.allowOnloadGetList = false;
				this.pagingListPostDataContent = {
					affaircate_id: id
				}
				this.listData = [];
				this.article = this.listData;
				this.pagingListToggle();
			},
			//查询军事理论分类
			async getul6beef671a111Func() {
				//请求方法
				//数据验证
				let datatabs = await this.$api.get(global.apiUrls.post66beef671a111, {

				});
				if (datatabs.data.code != 1) {
					this.$message.info(datatabs.data.msg);
					return
				}
				let infotabs = datatabs.data;
				this.tabs = infotabs.data
			},
			pagingListPostData() {
				return this.pagingListPostDataContent
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;
	}

	.theory_flex_0 {
		background: #CC221C;
		background-size: 100% auto;
		height: 100rpx;
		width: 100%;
		// padding: 66rpx 32rpx 0rpx 32rpx;
		position: fixed;
		margin: 0rpx 0rpx 0rpx 0rpx;
		z-index: 99999999;
	}

	.theory_fd0_0_c2 {
		font-size: 32rpx;
		color: var(--benbenFontColor3);
	}

	.theory_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		line-height: 50rpx;
		color: var(--benbenFontColor3);
		margin: 0rpx 0rpx 0rpx 12rpx;
	}

	.theory_fd0_0_c0 {
		font-size: 36rpx;
		color: var(--benbenFontColor3);
	}

	.theory_fd0_0 {
		background: #CC221C;
		color: #ff3737;
		width: 100%;
		// margin: -71rpx 0rpx 0rpx -34rpx;
		height: 100rpx;
		background-size: 100% auto;
		position: fixed;
		padding: 0rpx 32rpx 0rpx 32rpx;
		z-index: 9666666;
	}

	.theory_flex_1 {
		border-radius: 24rpx 24rpx 0rpx 0rpx;
		padding: 24rpx 24rpx 24rpx 24rpx;
	}

	.theory_numberfd1_0_c0 {
		background: #525050;
		position: absolute;
		bottom: 20rpx;
		right: 30rpx;
		width: 80rpx;
		height: 40rpx;
		border-radius: 6rpx 6rpx 6rpx 6rpx;
		font-size: 24rpx;
		color: #FFFFFF;
		line-height: 46rpx;
		font-weight: 400;
	}

	.theory_fd1_0_c1 {
		width: 702rpx;
		height: 200rpx;
		overflow: hidden;
	}

	.theory_fd1_0_c1_c0_c1 {
		line-height: 33rpx;
		font-size: 23rpx;
		font-weight: 500;
		color: #333333;
		text-align: center;
		width: 130rpx !important;
	}

	.theory_fd1_0_c1_c0_c0 {
		width: 95rpx;
		height: 85rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 16rpx 0rpx;
	}

	// theory_fd1_0_c1_c0_c1
	.theory_fd1_0_c1_c0 {
		margin: 19rpx 28rpx 19rpx 23rpx;
		width: 170rpx !important;
	}

	.theory_fd1_0 {
		background: rgba(255, 255, 255, 1);
		width: 702rpx;
		height: 200rpx;
		background-size: 100% auto !important;
		border-radius: 16rpx;
	}

	.theory_swiperDotUnselectedfd1_0 {
		background: #DBC674;
		width: 8rpx;
		height: 8rpx;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		font-size: 24rpx;
		color: #fff;
		margin: 0rpx 8rpx 0rpx 0rpx;
	}

	.theory_swiperDotSelectedfd1_0 {
		background: #DBC674;
		width: 24rpx;
		height: 8rpx;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		font-size: 24rpx;
		color: #fff;
		margin: 0rpx 8rpx 0rpx 0rpx;
	}

	::v-deep .theory_swiperDotfd1_0 {
		position: absolute;
		bottom: 10rpx;
		left: 0rpx;
		right: 0rpx;
	}

	.theory_flex_2 {
		margin: 30rpx 0rpx 0rpx 0rpx;
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.theory_fd2_0_c1 {
		width: 248rpx;
		height: 160rpx;
		border-radius: 16rpx;
	}

	.theory_fd2_0_c0_c1_c0 {
		line-height: 33rpx;
		margin: 0rpx 20rpx 0rpx 0rpx;
	}

	.theory_fd2_0_c0_c1 {
		height: 40rpx;
		color: rgba(153, 153, 153, 1);
		font-size: 24rpx;
	}

	.theory_fd2_0_c0_c0 {
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		font-size: 28rpx;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
		line-height: 40rpx;
	}

	.theory_fd2_0_c0 {
		width: 364rpx;
		height: 100%;
		margin: 0rpx 20rpx 0rpx 0rpx;
	}

	.theory_fd2_0 {
		background: #fff;
		margin: 0rpx 0rpx 24rpx 0rpx;
		height: 208rpx;
		width: 686rpx;
		background-size: 100% auto;
		border-radius: 16rpx;
		padding: 24rpx;
	}
	.btns{
		width: 120rpx;
	}
</style>
